package com.dkm.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.JobDetailFactoryBean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.scheduling.quartz.SimpleTriggerFactoryBean;

import com.dkm.quartz.TraceWarnJob;

/**
 * quartz配置类
 * @author 狄凯明
 *
 */
//@Configuration
//public class QuartzConfig {
//
//	/**
//	 * 1.创建job对象
//	 */
//	@Bean
//	public JobDetailFactoryBean jobDetailFactoryBean() {
//		
//		JobDetailFactoryBean factory=new JobDetailFactoryBean();
//		//关联我们自己的job类
//		factory.setJobClass(TraceWarnJob.class);
//		
//		return factory;
//	}
//	/**
//	 * 2.创建Trigger对象
//	 */
//	@Bean
//	public SimpleTriggerFactoryBean simpleTriggerFactoryBean(JobDetailFactoryBean jobDetailFactoryBean) {
//		SimpleTriggerFactoryBean factory=new SimpleTriggerFactoryBean();
//		//关联JobDetail对象
//		factory.setJobDetail(jobDetailFactoryBean.getObject());
//		//执行间隔毫秒
//		factory.setRepeatInterval(2000);
//		//重复次数0表示只会触发一次
//		factory.setRepeatCount(0);
//		
//		return factory;
//	}
//	/**
//	 * 3.创建Scheduler对象
//	 */
//	@Bean
//	public SchedulerFactoryBean schedulerFactoryBean(SimpleTriggerFactoryBean simpleTriggerFactoryBean) {
//		SchedulerFactoryBean factory=new SchedulerFactoryBean();
//		//关联trigger
//		factory.setTriggers(simpleTriggerFactoryBean.getObject());
//		
//		return factory;
//	}
//}
